<?
require("config.php");

if (!$id) {

$table = "course_sharing";

$field = array(

"id",
"schedule",
);

$exp = "ORDER by id desc";
$r = unlimitQuery($table,$field,$exp);
$schedule = $r[0][1];

$table = "course_schedule";
$field = array(

"id"
);

$exp = "AND name = '$schedule'";

$r = unlimitQuery($table,$field,$exp);

$id = $r[0][0];
}


$table = "course_schedule";

$field = array(

"id",
"date",
"name",
);

if ($id) $exp = "AND id = $id ";

$exp .= "ORDER by id desc Limit 1";

$r = unlimitQuery($table,$field,$exp);

$date = $r[0][1];
$name = $r[0][2];
$id=$r[0][0];


$table = "course_sharing";

$field = array(

"id",
"graduate",
"schedule",

"detail",
"picture1",
"picture2",
"picture3",
);

$exp = "AND schedule = '$name' ORDER by id desc";

$r = unlimitQuery($table,$field,$exp);

for ($i=0;$i<count($r);$i++){
		 $Details .= "<p><u>" . $r[$i][1] . "</u><br>" . $r[$i][2] . "</p>";

}

?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title><?=$Subject?></title>
</head>
<body onLoad="window.print();">

<table border=0 width=640 cellpadding=0 cellspacing=1>
<tr>
<td><img src="images/logo1.gif" width="162" height="108"></td>
<td align="right"><font face="arial" size="2"><?=date("Y-m-d H:i")?>&nbsp;&nbsp;&nbsp;</font></td>
</tr>
</table>


<table border=0 width=640 cellpadding=0 cellspacing=1 bgcolor="#000000">
<tr>
    <td>
<table border=0 width=640 cellpadding=20 cellspacing=1 bgcolor="#FFFFFF">
<tr><td>

<font face="Times New Roman" size="3">
<p align = "center"><b><?=$name?></b></p>
<p align = "center">(<?=outDate($date)?>)</p>

<table>
<tr><td valign="top">
		  <a href="<?=$PIC_DIR . "$table/" . $r[0][4]?>" target="_blank"><?=showPic($PIC_DIR . "$table/sm_" . $r[0][4],"")?></a><br>
		  <a href="<?=$PIC_DIR . "$table/" . $r[0][5]?>" target="_blank"><?=showPic($PIC_DIR . "$table/sm_" . $r[0][5],"")?></a><br>
		  <a href="<?=$PIC_DIR . "$table/" . $r[0][6]?>" target="_blank"><?=showPic($PIC_DIR . "$table/sm_" . $r[0][6],"")?></a>
</td><td valign="top">
<?=$r[0][3]?>
</td></tr>
</table>
<p>&nbsp;</p>
</font>
</td></tr></table>

</td></tr></table>

<table border=0 width=640 cellpadding=20 cellspacing=1 bgcolor="#FFFFFF">
<tr><td>

<br>
<p align="center">
<a href="http://www.acuityworld.com" target="_blank"><font face="arial">http://www.acuityworld.com</font></a>
</p>
</td></tr></table>

</body>
</html>